Added ProtocolHelper and some tests
[brmtron.git] / BrmTron Server / src / cz / brmlab / brmtron / server / Player.java
blob4eba874dd8eeae03f26399d15df8e3af0b40f25a
1 package cz.brmlab.brmtron.server;
3 public class Player {
5 private int id=0;
6 private String name = "Player";
7 private double longitude = 0;
8 private double latitude = 0;
9 private double[] prevCoords = new double[2];
10 private boolean active = false;
12 public Player(int id) {
13 this.id = id;
16 public int getId() {
17 return id;
20 public void setId(int id) {
21 this.id = id;
24 public void setLongitude(double longitude) {
25 this.longitude = longitude;
28 public double getLatitude() {
29 return latitude;
32 public void setLatitude(double latitude) {
33 this.latitude = latitude;
36 public boolean isActive() {
37 return active;
40 public void setActive(boolean active) {
41 this.active = active;
44 public double getLongitude() {
45 return longitude;
48 public double[] getCoords(){
49 double[] ret = new double[2];
50 ret[0] = getLongitude();
51 ret[1] = getLatitude();
52 return ret;
55 public void setCoords(double x, double y) {
56 this.setPrevCoords(longitude, latitude);
57 this.longitude = x;
58 this.latitude = y;
61 public void setPrevCoords(double x, double y) {
62 this.prevCoords[0] = x;
63 this.prevCoords[1] = y;
66 public double[] getPrevCoords() {
67 return prevCoords;
70 public String getName() {
71 return name;
74 public void setName(String name) {
75 this.name = name;
78 public void merge(Player np) {
79 //TODO lip osetrit merge Playeru
80 longitude = np.getLongitude();
81 latitude = np.getLatitude();